<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<?php $title = '用户注册'; ?>
<head>
	<meta charset="UTF-8">
	<title><?php echo ($title); ?></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<link rel="stylesheet" href="/Application/Home/View//Public/static/css/weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/jquery-weui.min.css"/>
    <link rel="stylesheet" href="/Application/Home/View//Public/static/css/custom.css"/>
    <style type="text/css">
		body{
			background:#f1f1f1;
			color:#a3a3a3;
			font-family:"Microsoft YaHei";
		}
		.bd{
			padding:20px;
		}
        li{list-style: none;}
		p{
			font-size: 13px;
		}
		.weui-cell_select-before .weui-cell__hd:before{
			border-width: 0px 2px 2px 0;
			margin-top: -6px;
		}
		.weui-cell_select-before .weui-cell__hd:after{border:none;}
        .sstmb {
            padding-bottom: 60px;
        }
        .foot-ul{
			text-align:center;
			margin-top: 1rem;
			padding:10px;
			background: #22a9fe;
			opacity: 0.9;
		}
		.foot-ul a{
			color: #fff;
		}
		.foot-ul a img{
			max-width: 24px;
		}
		.pinglun{
			padding: 0 2px;
			background: #ff5959;
			border-radius: 50px;
			color: #fff;
			position: absolute;
			top:-6px;
			left:73px;
			font-size: 13px;
		}
		
		
		.weui-cell__bd p{
		color:#6b6969;
		}
        
	</style>
</head>

<body ontouchstart>

	<div class="container js_container">

    </div>
<div class="page">
    <div class="bd">
         <div style="height:40px">
         <?php if($tid): ?>来自 <?php echo ($m["true_name"]); ?> <?php echo (fmt_hide($m["telephone"])); ?> 的推荐<?php endif; ?>
         </div>
        <div style="background:#fff;" class="weui_cells ">

        <div class="weui-cell weui-cell_select weui-cell_select-before">
		<div class="weui_cell_hd"><img src="/Application/Home/View//Public/static/images/user.png" alt="" style="width:17px;margin-left:20px;display:block"></div>
        <div style="width:80px;" class="weui-cell__hd">
          <select class="weui-select" name="select2">
            <option value="1">+86</option>
            <option value="2">+80</option>
            <option value="3">+84</option>
            <option value="4">+87</option>
          </select>
        </div>
        <div style="padding-left:0;" class="weui-cell__bd">
          <input style="border-left:1px solid #d9d9d9;padding-left:10px;" id="phone" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入号码">
        </div>
      </div>

			<div style="height:44px;" class="weui-cell weui-cell_select weui-cell_select-before">
				<div class="weui_cell_hd"><img src="/Application/Home/View//Public/static/images/yzm.png" alt="" style="width:17px;margin-left:20px;display:block"></div>
				<div style="display:inline-block;" class="weui-cell__bd">
					<input style="width:40%;" class="weui-input" type="number" pattern="[0-9]*" id="verify_code" placeholder="输入验证码">
					<div  style="float:right;" class="button_sp_area">
						<a style="display:block;background:#e8f6ff;color:#6dbffe;" href="javascript:get_verify_code();" class="weui-btn weui-btn_mini weui-btn_primary" id="verify_timer">发送验证码</a>
					</div>
				</div>
			</div>
			   <!--    <div style="height:44px;" class="weui-cell weui-cell_select weui-cell_select-before">
	 <div class="weui_cell_hd"><img src="/Application/Home/View//Public/static/images/user.png" alt="" style="width:17px;margin-left:20px;display:block"></div>
        <div class="weui-cell__bd">
          <input  class="weui-input" type="text" id="username" placeholder="请输用户名">
        </div>
      </div> -->
            <div style="height:44px;" class="weui-cell weui-cell_select weui-cell_select-before">
	  <div class="weui_cell_hd"><img src="/Application/Home/View//Public/static/images/pass.png" alt="" style="width:17px;margin-left:20px;display:block"></div>
        <div class="weui-cell__bd">
          <input  class="weui-input" type="text" id="pwd" placeholder="请输入密码">
        </div>
      </div>

 <!--     <div style="height:44px;" class="weui-cell weui-cell_select weui-cell_select-before">
	  <div class="weui_cell_hd"><img src="/Application/Home/View//Public/static/images/pass.png" alt="" style="width:17px;margin-left:20px;display:block"></div>
        <div class="weui-cell__bd">
          <input  class="weui-input" type="text" id="invent_code" placeholder="请输入邀请码">
        </div>
      </div>
-->
        </div>


        <div style="margin:2rem auto;width:11rem;border-radius:20px;" class='demos-content-padded'>
      <a style="background:#22a9fe;" href="javascript:reg_mem();" class="weui-btn weui-btn_primary">立即注册</a>
	  </div>
      <input type="hidden" id="tid" value="<?php echo ($tid); ?>" />
      
       <div style="margin:2rem auto;width:11rem;border-radius:20px;" class='demos-content-padded'>
      <a style="background:#efeff4;"  href="<?php echo U('login/index');?>" class="weui-btn weui-btn_default">老用户登录</a>
	  </div>
	  
	  
     <!-- <div style="margin-top:.6rem;text-align:center;" class="weui_cell_ft">
            <a style="color:#a3a3a3;" href="<?php echo U('login/index');?>"><div  class="weui_cells_title">已有帐号，我要登录</div></a>
        </div> -->
    </div>
</div>
<input type='hidden' id='is_open' value='<?php echo ($is_open_pay); ?>' />
    <script src="/Application/Home/View//Public/static/js/jquery-2.1.4.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery-weui.min.js"></script>
    <script src="/Application/Home/View//Public/static/js/fastclick.js"></script>
    <script src="/Application/Home/View//Public/static/layer/layer.js"></script>
    <script src="/Application/Home/View//Public/static/js/jquery.form.js"></script>
    <script>
      $(function() {
        FastClick.attach(document.body);
      });
    </script>
</body>
</html>
<script>
  var timer = '';
  var i = 60;
  function get_verify_code(){
      if($("#phone").val().length == 11){
         $.ajax({
            url:"<?php echo U('login/get_verify_code');?>",
            data:{phone:$("#phone").val()},
            type:"POST",
            success:function(data){
                var data = JSON.parse(data);
                if(data['code'] == '0'){
                   $.alert('发送成功!');
                   $("#verify_timer").removeAttr('href');
                   timer = setInterval(function(){
                      i--;
                      if(i <= 0){
                          clearInterval(timer);
                          i = 60;
                          $("#verify_timer").html('发送验证码');
                          $("#verify_timer").attr('href', 'javascript:get_verify_code();');
                      }else{
                          $("#verify_timer").html(i+'秒后重发');
                      }
                   }, 1000);
                }else{
                   $.alert(data['msg']);
                }
            }
         })
      }else{
         $.alert('请输入正确的手机号码!');
      }
  }
  
  function reg_mem(){
      if($("#phone").val()==''){
         $.alert('请输入手机号码!');
         return false;
      }
      if($("#verify_code").val() == ''){
         $.alert('请输入验证码!');
         return false;
      }
      
      if($.trim($("#pwd").val())  == ''){
         $.alert('请输入密码!');
         return false;
      }
      
      $.ajax({
         url:'<?php echo U("login/register");?>',
         data:{phone:$("#phone").val(), verify_code:$("#verify_code").val(), pwd:$("#pwd").val(), tid:$("#tid").val()},
         type:"POST",
         success:function(data){
             if(data == -99){
                $.alert('验证码不正确!');
             }else if(data == -98){
                $.alert('手机号码已注册!');
             }else if(data == -97){
                $.alert('用户名已注册!');
             }else if(data == 1){
                $.alert('注册成功!', function(){
                   location.href = '<?php echo U("Login/index");?>';
                   /*
                   if($("#is_open").val() == 0){
                       location.href = '<?php echo U("Login/index");?>'; 
                   }else{
                       location.href = '<?php echo U("Login/account_up");?>';
                   }
                   */
                });
             }else{
                $.alert('系统繁忙，请稍后重试!');
             }

         }
      })
      
  }
</script>